-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[repo] generate version.py in Makefile #14791
base: main
Are you sure you want to change the base?
Conversation
b42f83c
to
572f03a
Compare
aed9c05
to
85a821b
Compare
def __load_module(name, path): | ||
spec = spec_from_file_location(name, path) | ||
mod = module_from_spec(spec) | ||
sys.modules[name] = mod | ||
spec.loader.exec_module(mod) | ||
return mod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is arguably the only more complicated bit about this change. I could have used a regex to read extract this information but settled on this as I believe it would fail if we changed versioning in the future and forgot to modify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL this was possible. Pretty cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me, and I have confirmed this makes its way through to the API responses correctly. Could you please add a security comment ala https://github.com/hail-is/hail/blob/main/.github/pull_request_template.md ?
def __load_module(name, path): | ||
spec = spec_from_file_location(name, path) | ||
mod = module_from_spec(spec) | ||
sys.modules[name] = mod | ||
spec.loader.exec_module(mod) | ||
return mod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL this was possible. Pretty cool.
This generates the hail version in a way that's importable in python and javascript (for webpages). It simplifies how the version is used in those languages as well as the number of files we need to juggle in CI.